#include <iostream>
#include <stdio.h>
#include <vector>
#include <cmath>

using namespace std;

typedef pair<int, int> PII;
vector<vector<int>> graph(25, vector<int>(25, 0)); // 25x25 matrix
vector<int> northlist(25);
vector<int> westlist(25);

bool st[25][25];
void print(vector<PII> path , int N)
{
    for (int i = 0; i < path.size(); i++)
    {
        printf("%d ", path[i].first * N + path[i].second);
    }
    printf("\n");
}
bool check(int n)
{
    for (int i = 0; i < n; i++)
    {
        if (northlist[i] != 0 || westlist[i] != 0)
        {
            return false;
        }
    }
    return true;
}
bool dfs(int n, int x, int y, vector<PII> &path)
{
    if (x >= n || y >= n || x < 0 || y < 0)
    {
        return false;
    }
    if (!st[x][y])
    {
        st[x][y] = true;
        northlist[y]--;
        westlist[x]--;
        if (northlist[y] < 0 || westlist[x] < 0)
        {
            northlist[y]++;
            westlist[x]++;
            st[x][y] = false;
            return false;
        }
        path.push_back({x, y});

        if (x == n - 1 && y == n - 1)
        {
            if (check(n))
            {
                return true;
            }
            else
            {
                path.pop_back();
                northlist[y]++;
                westlist[x]++;
                st[x][y] = false;
            }
            return false;
        }
        if (dfs(n, x, y + 1, path))
            return true;
        if (dfs(n, x + 1, y, path))
            return true;
        if (dfs(n, x, y - 1, path))
            return true;
        if (dfs(n, x - 1, y, path))
            return true;
        path.pop_back();
        northlist[y]++;
        westlist[x]++;
        st[x][y] = false;
    }
    return false;
}


int main()
{
    int N;
    scanf("%d", &N);

    for (int i = 0; i < N; i++)
    {
        scanf("%d", &northlist[i]);
    }

    for (int i = 0; i < N; i++)
    {
        scanf("%d", &westlist[i]);
    }

    vector<PII> path;
    dfs(N, 0, 0, path);
    print(path, N);

    printf("\n");
    return 0;
}